import logging, datetime
from settings import SETTINGS

def getlogger(name):
    logger = logging.getLogger(name)
    path = SETTINGS['logs_path']
    hdlr = logging.FileHandler("%s/py_job-%s.log" % (path, str(datetime.date.today()) ))
    formatter = logging.Formatter('[%(asctime)s]%(levelname)-8s"%(message)s"','%Y-%m-%d %a %H:%M:%S')

    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.DEBUG)
    return logger
